package com.droidexchange.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class Const
{
	public static final String	SEP			= "/";
	public static final String	TAG			= "droid-exch";
	public static final String	APIKEY		= "7W61J7OxMECmxQXEkQlIWw";

	public final static int					INTENT_FILTER_ACTIVITY	= 0;
	public final static int					INTENT_TAGS_ACTIVITY	= 1;

	private static SharedPreferences		sp;
	private static SharedPreferences.Editor	spe;

	public static void init(Context context)
	{
		sp = PreferenceManager.getDefaultSharedPreferences(context);
		spe = sp.edit();
	}

	public static int getPref(String key, int defValue)
	{
		return sp.getInt(key, defValue);
	}

	public static void putPref(String key, int val)
	{
		spe.putInt(key, val);
		spe.commit();
	}

	public static boolean getPref(String key, boolean defValue)
	{
		return sp.getBoolean(key, defValue);
	}

	public static void putPref(String key, boolean val)
	{
		spe.putBoolean(key, val);
		spe.commit();
	}

	public static long getPref(String key, long defValue)
	{
		return sp.getLong(key, defValue);
	}

	public static void putPref(String key, long val)
	{
		spe.putLong(key, val);
		spe.commit();
	}

	public static String getPref(String key, String defValue)
	{
		return sp.getString(key, defValue);
	}

	public static void putPref(String key, String val)
	{
		spe.putString(key, val);
		spe.commit();
	}
}
